<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>练习4：创建继承Person的Student子类</title>
	</head>
	<body>
		<div id="name"></div>
		<div id="chinese"></div>
		<div id="math"></div>
		<div id="age"></div>
		
	</body>
	<script>
		function Person(name,chinese,math){
			this.name=name;
			this.chinese=chinese;
			this.math=math;
		}
		Person.prototype.showName=function(){
			return this.name;
		};
		Person.prototype.showChinese=function(){
			return this.chinese;
		}
		Person.prototype.showMath=function(){
			return this.math;
		}
		function Student(name,chinese,math,age){
			Person.call(this,name,chinese,math);
			this.age=age;
		}
		Student.prototype=new Person();
		Student.prototype.showAge=function(){
			return this.age;
		}
		var student=new Student("张三",98,80,25)
		console.log(student);
		document.getElementById("name").innerHTML="姓名："+student.showName();
		document.getElementById("chinese").innerHTML="语文："+student.showChinese();
		document.getElementById("math").innerHTML="数学："+student.showMath();
		document.getElementById("age").innerHTML="年龄："+student.showAge();
	</script>
</html>
